<%@page import="hyl.ext.base.MySession"%>
<%@page import="com.servlet.M2"%>
<%@page language="java" contentType="application/json;charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page	import="hyl.core.db.*,com.servlet.My,hyl.core.info.Content,hyl.core.MyFun"%>
<%
//查询列表数据
	MySession tk = My.getSession(request,response);
	int role = tk.getRoleid();
	int index = MyFun.str2int(request.getParameter("rs_index"));
	int size = MyFun.str2int(request.getParameter("rs_size"));
	String appB = request.getParameter("appB");
	String userA = request.getParameter("userA");
	String userB = request.getParameter("userB");
	Content ct = new Content();
	////////////////////////////////dao//////////////////////////////////
	MySqlSelect count = MySqlSelect	.getInstance("SELECT COUNT(1) AS total FROM app a ,app_user b WHERE a.appid=b.appb");
	
	String sql = " SELECT b.openid,b.appb,a.t0,b.uida,b.uidb, b.ipb,b.ok,b.unameA,b.unameB  FROM app a ,app_user b WHERE a.appid=b.appb {1} ORDER BY b.openid DESC {2} ";

	MySqlSelect2 select = MySqlSelect2.getInstance(sql);
	SelectWhere sw = new SelectWhere();
	
	sw.addLike(" and a.t0 like ?",appB);
	sw.addLike(" and b.unameA like ?",userA);
	sw.addLike(" and b.unameB like ?",userB);
	count.addParams(sw);
	select.addParams(1, sw);
	select.fromto(2, index, size);
	//MyFun.print(sw._where.toString());
	//MyFun.printJson(sw._params);
	ct.setCode(1, "查询成功");
	ct.iniBodys(count.getMap());
	
	ct.addBodyItem("_rs", select.getList2D());
	out.print(ct.toJsonString());
%>